<?php
if (isset($_POST["save-mitsumori"]))
{
	$db = mysql_connect("mysql513.in.shared-server.net:16033", "JRtu434", "qvoiceDB1");
	mysql_select_db("JRtu434", $db);
	mysql_query("set SQL_BIG_Selects=1");
	mysql_query("SET NAMES utf8");
 	$query = "update RFQS set odate=\"".strtotime($_POST["odate"]).	"\", status=\"".
 	$_POST["status"]."\", subject=\"".$_POST["subject"]."\", samplesize=\"".$_POST["samplesize"].
 	"\", IR=\"".$_POST["IR"]."\", LOI=\"".$_POST["LOI"];
	if(isset($_POST["B2B"]))
		$query .= "\", B2B=\"".$_POST["B2B"]."\"";
	else
		$query .= "\", B2B=\"0\"";	
	$query .= ", feasibility = \"".$_POST["feasibility"]."\", company = \"".$_POST["company"].
	"\", contact = \"".$_POST["contact"]."\", cpc = \"".$_POST["cpc"]."\", genre = \"".$_POST["genre"].
	"\", request = \"".$_POST["request"]."\", reply = \"".$_POST["reply"].
	"\", followup=\"0\" where ID=\"".$_POST["id"]."\"";
	mysql_query($query);
	unset($_Post["save-mitsumori"]);
}

?><!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html lang="ja" xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
<!-- ==== document header ==== --> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<meta http-equiv="Content-Style-Type" content="text/css"> 
<meta http-equiv="Content-Script-Type" content="text/javascript"> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
<script type="text/javascript" src="/redirect/TestNew/tiny_mce/tiny_mce.js" ></script >
<script type="text/javascript">
$(document).ready(function()
{
	var bindbehaviors = function(scope) 
	{
		$("#addpane").click(function(){
   			$("#slideout").toggle("fast");
  		});
		tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "emotions,spellchecker,advhr,insertdatetime,preview,table", 
                
        // Theme options - button# indicated the row# only
        theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect",
        theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions",      
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
		theme_advanced_buttons3_add : "tablecontrols",
		table_styles : "Header 1=header1;Header 2=header2;Header 3=header3",
        table_cell_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Cell=tableCel1",
        table_row_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1",
        table_cell_limit : 100,
        table_row_limit : 10,
        table_col_limit : 10

		});
		$( ".datepicker" ).datepicker();
		
  		$("#companyselector").change(function()
		{
  			$("#contacts").load("dynamic.php?func=7&id="+$("#companyselector").val(),function()
			{
     			bindbehaviors(this);
     			});
 		});
	 	$("#add-contact").click(function()
	 	{
	 		var contname = encodeURI(document.frm.contname.value);
	 		var email = encodeURI(document.frm.email.value);
	 		var phone = encodeURI(document.frm.contphone.value);
	 		var country = encodeURI(document.frm.contcountry.value);
	 		var company = encodeURI(document.frm.company.value);
	 		var id = document.frm.id.value;
	 		//alert("dynamic.php?func=11&contname="+contname+"&email="+email+"&phone="+phone+"&country="+country+"&company="+company+"&id="+id);
	 		$("#contacts").load("dynamic.php?func=11&contname="+contname+"&email="+email+"&phone="+phone+"&country="+country+"&company="+company+"&id="+id); 
			$("#slideout").toggle();
			//formObject = document.forms["frm"];
			//formObject.elements["contname"].value = "";
			//formObject.elements["email"].value = "";	
			//formObject.elements["contphone"].value = "";	
			//formObject.elements["contcountry"].value = "";			
	 	});	
		$(".navbutton").click(function()
		{
			$("#content").load("dynamic.php?func=8&id="+$(this).val(),function() 
			{
 				bindbehaviors(this);
	 		});
		});
		$(".idbrowser").change(function()
		{
			$("#content").load("dynamic.php?func=8&id="+$(this).val(),function() 
			{
 				bindbehaviors(this);
	 		});
		});
	};
	bindbehaviors(this);
});
</script>
<title>見積り入力</title>
<?php include 'layout.php'; ?> 
</head>
	<body>
		<div id="content">
			<?php include 'dynamic.php'; if (isset($_POST['id'])) drawmitsumori($_POST['id']); else drawmitsumori('0'); ?> 
		</div>
	</body>
</html>
